﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace firstCodeFirstApp
{
    public class Donator
    {
        public int DonatorId { get; set; }
        public string Name { get; set; }
        public decimal Amount { get; set; }
        public DateTime DonateDate { get; set; }
        public virtual ICollection<PayWay> PayWays { get; set; }

        public int? DonatorTypeId { get; set; }
        public virtual DonatorType DonatorType { get; set; }

        public Donator()
        {
            PayWays = new HashSet<PayWay>();
        }
    }

    public class DonatorType
    {
        public int Id { get; set; }
        public string Name { get; set; }

        public virtual ICollection<Donator> Donators { get; set; }

    }

    [Table("PayWay")]
    public class PayWay
    {


        public int Id { get; set; }

        [MaxLength(8, ErrorMessage = "支付方式的名称长度不能大于8")]
        public string Name { get; set; }

        [Column("DonatorId")]
        public int DonatorId { get; set; }

    }

    public class Person
    {

        public Person()
        {
            Companies = new HashSet<Company>();
        }

        public int PersonId { get; set; }
        public string Name { get; set; }
        public bool IsActive { get; set; }
        public virtual Student Student { get; set; }
        public virtual ICollection<Company> Companies { get; set; }

    }

    public class Student
    {
        public int PersonId { get; set; }
        public virtual Person Person { get; set; }
        public string CollegeName { get; set; }
        public DateTime EnrollmentDate { get; set; }


    }

    public class Company
    {
        public Company()
        {
            Persons = new HashSet<Person>();
        }

        public int CompanyId { get; set; }
        public string CompanyName { get; set; }
        public virtual ICollection<Person> Persons { get; set; }
    }


    



}
